# -*- coding: utf-8 -*- 
# 作者:飞虎
# 开发时间:2022/6/1 22:41
from PyQt5.Qt import *


class Window(QWidget):
	def __init__(self):
		super().__init__()
		self.setWindowTitle('QTableWidget学习')
		self.resize(500, 500)
		self.setup_ui()

	def setup_ui(self):
		layout = QHBoxLayout()
		tableWidget = QTableWidget(4,3)
		tableWidget.setHorizontalHeaderLabels(['姓名','性别',"体重"])
		item = QTableWidgetItem('王者荣耀')
		item.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable) # 设置名字不可编辑
		tableWidget.setItem(0,0,item)

		item = QTableWidgetItem('男')
		tableWidget.setItem(0,1,item)

		item = QTableWidgetItem('170')
		tableWidget.setItem(0,2,item)

		layout.addWidget(tableWidget)
		self.setLayout(layout)



if __name__ == '__main__':
	import sys

	app = QApplication(sys.argv)
	window = Window()
	window.show()
	sys.exit(app.exec_())